package com.simtop;

import com.simtop.util.worldUtil.WordDoc;
import com.simtop.vo.sj.ExamList;
import freemarker.template.Configuration;
import freemarker.template.Template;

import java.io.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName: test01
 * @Description TODO
 * @Author liuzhaobo
 * @Date 2022/11/4 0004 14:15
 * @Version 1.0
 **/
public class test05 {
    public static void main(String[] args) {
        try {


            Map<String, Object> dataMap = new HashMap<String, Object>();
            WordDoc wordDoc = new WordDoc();
            String imageStr = wordDoc.getImageStr("https://img-blog.csdnimg.cn/20210105221008901.png");
            dataMap.put("game",imageStr);


            Configuration configuration = new Configuration();
            configuration.setDefaultEncoding("UTF-8");
            configuration.setDirectoryForTemplateLoading(new File("C:\\Users\\Administrator\\Desktop\\形拓题库系统\\questionbank\\src\\main\\resources\\word"));
            File outFile = new File("D:/test02022.doc");
            Template t = configuration.getTemplate("test02.ftl", "utf-8");
            Writer out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(outFile), "utf-8"), 10240);
            t.process(dataMap, out);
            out.close();

        } catch (Exception e) {
            e.printStackTrace();
            System.out.println(e.getMessage());
        }

    }

}
